package com.itheima.mapper;

import com.itheima.pojo.CheckGroup;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CheckGroupDao {

    @Insert("insert into t_checkgroup values(null,#{code},#{name},#{helpCode},#{sex},#{remark},#{attention})")
    @SelectKey(statement = "select last_insert_id() from dual", before = false,
            resultType = Integer.class, keyColumn = "id", keyProperty = "id"
    )
    int add(CheckGroup checkGroup);


    @Delete("delete from t_checkgroup where id = #{id}")
    int delete(String id);


    List<CheckGroup> selectByCondition(String queryString);

    @Update("update t_checkgroup set code = #{code},name = #{name},helpCode = #{helpCode},sex=#{sex},remark=#{remark},attention=#{attention} where id = #{id}")
    int edit(CheckGroup checkGroup);

    @Select("select * from t_checkgroup")
    List<CheckGroup> findAll();

    @Select("select * from t_checkgroup where id = #{id}")
    CheckGroup findById(String id);
}
